package com.xgkj.diyiketang.task;

import com.alibaba.fastjson.JSONObject;
import com.xgkj.diyiketang.http.CouponHttpRequest;
import com.xgkj.diyiketang.http.CouponHttpResponse;
import com.xgkj.diyiketang.http.engine.CouponHttpBaseTask;
import com.xgkj.diyiketang.http.engine.TaskResultCode;

/**
 * Created by windo on 16/5/10.
 */
public class PinglunzhaopianTask extends CouponHttpBaseTask{
    private String commentContent;
    private String mImageId;
    private String mUserId;
    public PinglunzhaopianTask(String content,String imageId,String userId) {
        super(TaskType.ZANZHAOPIAN_TASK);
        commentContent = content;
        mImageId = imageId;
        mUserId = userId;
    }

    @Override
    protected void prepareRequest() {
        super.prepareRequest();
        if (mPhase ==TASK_PHASE_INIT){
            CouponHttpRequest request = new CouponHttpRequest(RequestType.PINGLUNHAOPIAN_REQUEST);
            JSONObject json = new JSONObject();
            json.put("commentContent",commentContent);
            json.put("imageId",mImageId);
            json.put("userId",mUserId);
            request.setData(json.toString());
            request.setApiNo(ApiNo.PINGLUNZHAOPIAN);
            addRequest(request);
        }
    }

    @Override
    protected void processResponseData(CouponHttpResponse response) {
        notifyTaskCompleted(TaskResultCode.SUCCESS,null);
    }
}
